#include"string.h"


namespace bit
{
	void test_string1()
	{
		bit::string s("hello world");
		cout << s.c_str() << endl;

		for (int i = 0; i < s.size(); i++)
		{
			s[i]++;
		}
		for (int i = 0; i < s.size(); i++)
		{
			cout<<s[i]<<" ";
		}


		 for(auto a:s)
		 {
			 cout << a << " ";
		 }
		 cout << endl;

	}

	void test_string2()
	{
		bit::string s("hello world");
		cout << s.c_str() << endl;

		s.push_back('x');
		s.push_back('x');
		s.push_back('x');
		s.push_back('x');
		s.push_back('x');

		s.append("hello world");
		s += 'x';
		s += "yyyy";
		cout << s.c_str() << endl;

	}

	void test_string3()
	{
		bit::string s("hello world");
		cout << s.c_str() << endl;

		/*s.insert(0, 'x');
		cout << s.c_str() << endl;

		s.insert(0, "yyy");
		cout << s.c_str() << endl;*/

		s.erase(5);
		cout << s.c_str() << endl;

	}

	void test_string4()
	{
		bit::string s("hello world");
		cout << s.c_str() << endl;
		cout<<s.find("w", 1)<<endl;
	}

	void test_string5()
	{
		bit::string s1("hello world");
		bit::string s2(s1);
		cout << s1.c_str() << endl;
		cout << s2.c_str() << endl;

		s1[0] = 'x';
		cout << s1.c_str() << endl;
		cout << s2.c_str() << endl;

		s1 = s2;
		cout << s1.c_str() << endl;
		cout << s2.c_str() << endl;
	}
} 



int main()	
{
	bit::test_string5();
	return 0;
}



